package com.kurumi.util;

/**
 * 地区工具类
 * 
 * @author 90669
 *
 */
public class AreaUtil {

	/**
	 * 
	 * @param drugStoreProvinceName
	 * @return
	 */
	public static String getDrugStoreProvinceName(String drugStoreProvinceName) {
		if (drugStoreProvinceName != null) {

			if (drugStoreProvinceName.endsWith("省")) {
				drugStoreProvinceName = drugStoreProvinceName.substring(0, drugStoreProvinceName.lastIndexOf("省"));
			} else if (drugStoreProvinceName.endsWith("直辖市")) {
				drugStoreProvinceName = drugStoreProvinceName.substring(0, drugStoreProvinceName.lastIndexOf("直辖市"));
			} else if (drugStoreProvinceName.endsWith("市")) {
				drugStoreProvinceName = drugStoreProvinceName.substring(0, drugStoreProvinceName.lastIndexOf("市"));
			} else if (drugStoreProvinceName.endsWith("自治区")) {
				drugStoreProvinceName = drugStoreProvinceName.substring(0, drugStoreProvinceName.lastIndexOf("自治区"));
			} else if (drugStoreProvinceName.endsWith("特别行政区")) {
				drugStoreProvinceName = drugStoreProvinceName.substring(0, drugStoreProvinceName.lastIndexOf("特别行政区"));
			} else if (drugStoreProvinceName.endsWith("行政区")) {
				drugStoreProvinceName = drugStoreProvinceName.substring(0, drugStoreProvinceName.lastIndexOf("行政区"));
			}
		}
		return drugStoreProvinceName;
	}

	public static String getDrugStoreCityName(String drugStoreCityName) {
		if (drugStoreCityName != null) {
			if (drugStoreCityName.endsWith("市")) {
				drugStoreCityName = drugStoreCityName.substring(0, drugStoreCityName.lastIndexOf("市"));
			} else if (drugStoreCityName.endsWith("自治州")) {
				drugStoreCityName = drugStoreCityName.substring(0, drugStoreCityName.lastIndexOf("自治州"));
			} else if (drugStoreCityName.endsWith("州")) {
				drugStoreCityName = drugStoreCityName.substring(0, drugStoreCityName.lastIndexOf("州"));
			} else if (drugStoreCityName.endsWith("盟")) {
				drugStoreCityName = drugStoreCityName.substring(0, drugStoreCityName.lastIndexOf("盟"));
			}
		}
		return drugStoreCityName;
	}
}
